package com.strelitzia.admin.controller;

import com.strelitzia.admin.Entity.PhotoEntity;
import com.strelitzia.admin.service.PhotoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;

import javax.jws.WebParam;
import java.util.List;
import java.util.stream.Collectors;


/**
 * @create 2024/1/23 16:44
 */
@Controller
public class PhotoController {
    @Autowired
    PhotoService photoService;

    @GetMapping("/photo")
    public String photo(Model model) {
        List<PhotoEntity> list = photoService.list();
        model.addAttribute("list", list.stream().map(PhotoEntity::getSrc).collect(Collectors.toList()));
        return "photo";
    }
}
